import request from '@/utils/request';
import { autograph } from '@/utils/autograph';

// 获取商品列表
export function goodsList(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 获取商品详情
export function getGoodsInfo(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 加入购物车
export function addCart(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 获取购物车总数
export function totalCart(query) {
    const url = '/Cart/ajaxCartTotal';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 显示购物车列表
export function getCartList(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 更新所选结算商品
export function AsyncUpdateCart(query) {
    const url = '/Cart/AsyncUpdateCart';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 订单页获取购物车数据
export function getCartTwo(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 获取用户收货地址
export function getUserAddress(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 新建编辑用户地址
export function addressSave(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 修改购物车数量
export function changeNum(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 删除购物车数据
export function cartDelete(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 生成订单 
export function makeOrder(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 我的订单列表
export function myOrderList(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 取消订单
export function orderCancel(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}
// 订单详情
export function orderInfo(query) {
    const url = 'Order/order_detail2';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 订单确认收货
export function orderConfrim(query) {
    const url = '';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    });
}

// 获取当前用户是否允许分享
export function getShare(query) {
    const url = 'User/is_distribut';
    const data = autograph(url, query);
    return request({
        url: url,
        method: 'post',
        data
    })
}